Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regen byron #194

Merged
merged 2 commits into from
Mar 23, 2023
Merged

Regen byron #194

merged 2 commits into from
Mar 23, 2023

Conversation

rooooooooob
Copy link
Contributor

using specs/byron_minimal.cddl

byron/utils.rs had to be modified a fair bit to deal with changes in
cddl-codegen since then, .cbor bytes support, etc.

using specs/byron_minimal.cddl

byron/utils.rs had to be modified a fair bit to deal with changes in
cddl-codegen since then, .cbor bytes support, etc.
@rooooooooob
Copy link
Contributor Author

to see which changes were made from the old code, ignore the first commit in the diff tab. the first commit is just copying over the old byron code directly.

}

impl_hash_type!(AddressId, 28);
// not sure if this is a hash but it likely is and has the same byte format
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK it was meant to be a hash and then this feature was never added to mainnet in the end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright I'll just leave it then. whatever it was meant to be, the hash type doesn't have any explicitly "hash" things I guess. it's just a fixed size byte buffer that can be converted to hex/etc.

AddressContent::hash_and_create(addr_type, &spending_data, attributes)
}

/// Do we want to remove this or keep it for people who were using old Byron code?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with either. If we don't need it, it's not hard to replace imo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After having run into some type annotations needed in a few places when trying to use the From/Into for addresses, I think we could just keep the to_address()/from_address() things everywhere since it'd also be consistent with wasm (where we can't expose traits) and would help people migrating from CSL/old CML.


; Addresses

; cddl had bootstrap as (1, uint) but byron/mod.rs had no uint field.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't remember off the top of my head the history to this, but I can look into it to try and remember

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may have just been a mistake on my part. The original cddl is addrdistr = [1] / [0, stakeholderid] and I think maybe I added a uint for the [1] case even though it shouldn't have been there

tag: 0, stakeholder_id //
; @name BootstrapEra
bootstrap_era: 1
]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to put the field name as bootstrap_era too since cddl-codegen's dcSpark/cddl-codegen#153 ignores @name for single-field group choices. i.e. tag: 1 as the field would make the entire variant come out as StakeDistribution::Tag instead of just the fixed field during serialization.

Copy link
Contributor

@SebastienGllmt SebastienGllmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rooooooooob rooooooooob merged commit 833aac4 into develop Mar 23, 2023
@rooooooooob rooooooooob deleted the regen-byron branch March 23, 2023 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants